import request from '../../../utils/request.js'
let app = getApp()

Page({

  /**
   * 页面的初始数据
   */
  data: {
    news: {}
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let newsId = options.id
    this.getNews(newsId)
  },

  getNews: function(id) {
    request.getRequest('/news/' + id).then(res => {
      if (res.code === 1) {
        this.setData({
          news: res.data
        })
      }
    })
  },
})